package com.itheima.list;

import java.util.Iterator;
import java.util.LinkedList;

public class Test02 {

    public static void main(String[] args) {

        LinkedList<String> list = new LinkedList<>();
        list.add("aaaa");
        list.add("aaaa");
        list.add("aaaa");
        list.add("aaaa");
        list.add("aaaa");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }


        for (String s : list) {
            System.out.println(s);
        }
        list.forEach(t-> System.out.println(t));

    }
}
